/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javagg2;

/**
 *
 * @author tim
 */


import com.golden.gamedev.*;
import com.golden.gamedev.object.*;
import com.golden.gamedev.object.background.*;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;


/**
 *
 * @author tim
 */
public class Javagg2 extends Game
{
    final static int WINDOW_WIDTH = 800;
    final static int WINDOW_HEIGHT = 800;
    final static int CHARACTER_PICTURE_COL_COUNT = 3;
    final static int CHARACTER_PICTURE_ROW_COUNT = 2;
    final static int CHARACTER_ANIMATION_STEP_TIME = 500;
    
    
    
    Character  Player;
    Background      background;
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
        GameLoader gl = new GameLoader();
        try
        {
            
            gl.setup(new Javagg2(),new Dimension(WINDOW_HEIGHT, WINDOW_WIDTH), false);
            gl.start();
        }
        catch (Exception e)
        {   
            System.out.println(e.getMessage()); 
        }
    }

    @Override
    public void initResources()
    {
        background = new ColorBackground(Color.BLACK, WINDOW_HEIGHT, WINDOW_WIDTH);
        Player = new Character(getImages("characters/BlueSoldier.png",CHARACTER_PICTURE_COL_COUNT,CHARACTER_PICTURE_ROW_COUNT));
        Player.setAnimate(true);
        Player.setLoopAnim(true);
       
        Player.setAnimationFrame(0, 1);
        Player.setAnimationTimer(new Timer(CHARACTER_ANIMATION_STEP_TIME));
        Player.setBackground(background);
        
    }

    @Override
    public void update(long l)
    {
        background.update(l);
        Player.update(l);
    }

    @Override
    public void render(Graphics2D gd)
    {
        background.render(gd);
        Player.render(gd);
    }
}

